package cn.moukou.dictator.dao.node;

import cn.moukou.dictator.pojo.node.KVNode;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;

import java.util.List;

public interface KVNodeDAO extends Neo4jRepository<KVNode, Long> {

//    @Query("match(kv:KVNode) where kv.node_type=$ return kv")
    public List<KVNode> findByNodeType(String name);

    @Query("match(kv:KVNode) where kv.student_name=$name return kv")
    public KVNode customFindByStudentName(String name);

    @Query("match(kv:KVNode) where kv.teacher_name=$name return kv")
    public KVNode customFindByTeacherName(String name);

    @Query("match(kv:KVNode) where kv.class_name=$name return kv")
    public KVNode customFindByClassName(String name);

    @Query("match(kv:KVNode) where kv.competition_name=$name return kv")
    public KVNode customFindByCompetitionName(String name);

    @Query("match(kv:KVNode) where kv.award_name=$name return kv")
    public KVNode customFindByAwardName(String name);

    @Query("match(kv:KVNode) where kv.student_organization_name=$name return kv")
    public KVNode customFindByStOrgName(String name);

    @Query("match(kv:KVNode) where kv.activity_name=$name return kv")
    public KVNode customFindByActivityName(String name);

    @Query("match(kv:KVNode) return kv order by kv.node_type")
    public List<KVNode> customFindAllOrderByType();
}